﻿using System;
using System.Collections.Generic;
using Autodesk.Revit.DB;

namespace HYRevitCode.CurveUtility.ColinearCurveGroup
{
	public class ColinearGroupManager
	{
		public ColinearGroupManager(List<Curve> inputCurves)
		{
			this.m_useCurves = inputCurves;
		}

		public List<List<Curve>> GetColinearGroup()
		{
			List<List<Curve>> list = new List<List<Curve>>();
			ColinearGroupMaker colinearGroupMaker = new ColinearGroupMaker();
			colinearGroupMaker.GroupingColinearCurve(this.m_useCurves);
			foreach (KeyValuePair<BaseLinePacker, List<Curve>> keyValuePair in colinearGroupMaker.ResultGroupDic)
			{
				ColinearCurveConnector colinearCurveConnector = new ColinearCurveConnector(keyValuePair.Key.BaseLine, keyValuePair.Value);
				list.Add(colinearCurveConnector.Connect());
			}
			return list;
		}

		private List<Curve> m_useCurves;
	}
}
